<template>
  <!-- 日志 -->
  <div class="container">
    <div class="search_wrap">
      <el-form label-position="right" label-width="100px">
        <el-row>
          <el-col :span="4">
            <el-form-item label="时间：" prop="">
              <el-date-picker
                    v-model="search.startTime"
                    value-format="yyyy-MM-dd"
                    class="startDate"
                    type="date"
                    placeholder="选择日期"/>
          </el-form-item>
          </el-col>
          <el-col align="right" :span="3">
            <el-button type="primary" @click="toSearch">搜索</el-button>
            <el-button @click="resetSearch">重置</el-button>
          </el-col>
        </el-row>

      </el-form>
      <div class="tabel_wrap">
        <el-table
            v-loading="listLoading"
            class="table"
            :data="list"
            element-loading-text="Loading"
            :row-class-name="getRowClassName"
            border
            fit
            highlight-current-row
            >
            <el-table-column align="center" label="日期" width="">
                <template slot-scope="scope">
                {{ scope.row.date }}
                </template>
            </el-table-column>
            <el-table-column align="center" label="操作" width="300">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="primary"
                  @click="downLoadHandle(scope.row.id)">下载</el-button>
              </template>
            </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>
<script>
import { getLogs } from '@/api/memberManage';
export default {
  data() {
    return {
      search: {
        startTime: ''
      },
      total: 0,
      listQuery: {
        pageIndex: 0,
        pageSize: 10
      },
      listLoading: false,
      list: [],
    }
  },
  methods: {
    resetSearch() {
      this.search.startTime = ''
    },
    downLoadHandle() {

    },
    toSearch() {
      const newData = this.objectCon(this.listQuery, this.search)
      this.listLoading = true
      getLogs(newData).then(response => {
        console.log(response)
        this.list = response.data
        this.total = response.total
        setTimeout(() => {
          this.listLoading = false
        }, 1.5 * 1000)
      })
    },
    fetchData() {
      const newData = this.objectCon(this.listQuery, this.search)
      this.listLoading = true
      getLogs(newData).then(response => {
        console.log(response)
        this.list = response.data
        this.total = response.total
        setTimeout(() => {
          this.listLoading = false
        }, 1.5 * 1000)
      })
    },
  }
}

</script>
